
<template>
  <div class="execution">
    <basic-container>
      <avue-crud
        :permission="permissionList"
        :upload-after="uploadAfter"
        v-model="form"
        v-bind="bindVal"
        v-on="onEvent"
        :page.sync="page"
      >
        <template  slot="menu"
          slot-scope="scope">
          <el-button v-if="scope.row.file!=null"
            type="text"
            size="mini"
            icon="el-icon-download"
            @click="download(scope.row)">下载 </el-button>
        </template>
        <template slot="menuLeft">
          <el-button type="primary" size="small" @click="hanldeExport">导出</el-button>
        </template>
      </avue-crud>
    </basic-container>
  </div>
</template>

<script>
import {
  fetchList,
  getObj,
  download,
  exportExcel
} from "@/api/subwaystm/swstapplynetworkcheckpassengeraffairsother";
import { tableOption } from "@/const/crud/subwaystm/swstapplynetworkcheckpassengeraffairsother";
import { mapGetters } from "vuex";
import { handleDownFile } from '@/util/util'
import baseCrud from '@/mixins/base-crud'

export default {
  name: "swstapplynetworkcheckpassengeraffairs",
  mixins: [baseCrud('subwaystm/swstapplynetworkcheckpassengeraffairsother')],
  data() {
    return {
    };
  },


  created() {
    this.dycColumn(this.userInfo.belongToLine)
    console.log(this.userInfo.belongToLine)
  },
  computed: {
    ...mapGetters(["permissions","userInfo"]),
    permissionList() {
      return {
        addBtn: this.vaildData(
          this.permissions.stm_swstapplynetworkcheckpassengeraffairs_add,
          false
        ),
        delBtn: this.vaildData(
          this.permissions.stm_swstapplynetworkcheckpassengeraffairs_del,
          false
        ),
        editBtn: this.vaildData(
          this.permissions.stm_swstapplynetworkcheckpassengeraffairs_edit,
          false
        )
      };
    },

  },
  methods: {
    dycColumn:function(val){
      var lineCode =this.findObject(this.tableOption.column,'lineCode')
      var stationCode =this.findObject(this.tableOption.column,'stationCode')
      console.log(lineCode)
      if(val!=true){
        console.log("车站")
        lineCode.hide=true
         stationCode.hide=true
      }else{
           console.log("线网")
        lineCode.hide=false
         stationCode.hide=false
      }
    },
    download : function(row){
      handleDownFile(row.file);
    }
  }
};
</script>
